
import java.io.BufferedReader;
import java.io.FileReader;

import weka.core.Instance;
import weka.core.Instances;
import weka.core.converters.ArffLoader.*;

public class ArffFileRead {
	
	public void readARFFFile(){
		
		try{
			BufferedReader reader = new BufferedReader(new FileReader("C:\\test1.arff"));
			Instances data = new Instances(reader);
			reader.close();
			// setting class attribute
			data.setClassIndex(data.numAttributes() - 1);
			
			System.out.println("Test1 = " + (data.numAttributes() - 1) + "  " );
			System.out.println(data.lastInstance());
			System.out.println(data.kthSmallestValue(0, 1));
			System.out.println(data.meanOrMode(3));
		}catch(Exception e){
			
		}
	}
	
	public static void main(String args[]){
		ArffFileRead ar = new ArffFileRead();
		ar.readARFFFile();
	}

}
